﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;

namespace DARE
{
    public class CVignetteData : CButtonData
    {
        public CStaticTextData bottomLeftText;
        public CStaticTextData bottomRightText;
        public CStaticTextData topLeftText;
        public CStaticTextData topRightText;
        public int cumulated;
        public int cumulLimit;
        public int id;
        public bool isCumulable;
        public bool isProduceer;
        public string lastAttachedTo;
        public long type;

        public override void FillDataStructure(CWidget wid)
        {
            CVignette w = wid as CVignette;
            base.FillDataStructure(wid);
            bottomLeftText = new CStaticTextData();
            bottomLeftText.FillDataStructure(w.BottomLeftText);
            bottomRightText = new CStaticTextData();
            bottomRightText.FillDataStructure(w.BottomRightText);
            cumulated = w.Cumulated;
            cumulLimit = w.CumulLimit;
            id = w.ID;
            isCumulable = w.IsCumulable;
            isProduceer = w.IsProduceer;
            if (w.LastAttachedTo != null)
                lastAttachedTo = w.LastAttachedTo.Name;
            topLeftText = new CStaticTextData();
            topLeftText.FillDataStructure(w.TopLeftText);
            topRightText = new CStaticTextData();
            topRightText.FillDataStructure(w.TopRightText);
            type = w.Type;
        }

        public override void FillFromDataStructure(ref CWidget wid, CHUDSystem hud)
        {
            base.FillFromDataStructure(ref wid, hud);
            //vig.BottomLeftText.Text = bottomLeftText.text;
            //bottomRightText;
            //topLeftText;
            //topRightText;
            (wid as CVignette).Cumulated = cumulated;
            (wid as CVignette).CumulLimit = cumulLimit;
            (wid as CVignette).ID = id;
            (wid as CVignette).IsCumulable = isCumulable;
            (wid as CVignette).IsProduceer = isProduceer;
            if (lastAttachedTo != null)
                (wid as CVignette).LastAttachedTo = hud.GetElement(lastAttachedTo);
            (wid as CVignette).Type = type;
            (wid as CVignette).BottomLeftText = hud.GetElement(name + "BOTTOMLEFT") as CStaticText;
            (wid as CVignette).BottomRightText = hud.GetElement(name + "BOTTOMRIGHT") as CStaticText;
            (wid as CVignette).TopLeftText = hud.GetElement(name + "TOPLEFT") as CStaticText;
            (wid as CVignette).TopRightText = hud.GetElement(name + "TOPRIGHT") as CStaticText;
        }
    }
}
